﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CashShop.Bussiness
{
    class CashReturn:CashSuper
    {
        //满减的条件
        private decimal _moneyCondition = 0M;
        //满减返现的金额
        private decimal _moneyReturn = 0M;
        public CashReturn(string moneyCondition,string moneyReturn)
        {
            this._moneyCondition = Convert.ToDecimal(moneyCondition);
            this._moneyReturn = Convert.ToDecimal(moneyReturn);
        }
        public override decimal AcceptCash(decimal money)
        {
            var totalPrice = money;
            if (money >= _moneyCondition)
            {
                totalPrice = money - Math.Floor(money / _moneyCondition) * _moneyReturn;
            }
            return totalPrice;
        }
    }
}
